const Koa = require('koa');
const app = new Koa();
const router = require('./route/route');
const logger = require('koa-logger');

const mongoose = require('mongoose');
mongoose.Promise = global.Promise;
// mongoose.Promise = require('bluebird');

mongoose.connect('mongodb://localhost/local', {
    socketTimeoutMS: 0,
    keepAlive: true,
    reconnectTries: 30,
    useMongoClient: true
});

app.use(logger());

app.use(router.routes());
app.use(router.allowedMethods());

app.listen(3000);